home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Mag HDD Backup
/
Amiga Mag HDD Backup.zip
/
Amiga Mag HDD Backup
/
Alexander.img.bin
/
Alexander.img
/
tech 4.1 editorial Archive.sit
/
Nee
/
dpmathmacros.i
< prev
next >
Wrap
Text File
|
1993-07-16
|
7KB
|
411 lines
;LISTING 1
;MATHIEEEDOUBBAS OFFSETS
dpfix equ -30
dpflt equ -36
dpcmp equ -42
dptst equ -48
dpabs equ -54
dpneg equ -60
dpadd equ -66
dpsub equ -72
dpmul equ -78
dpdiv equ -84
;macros
dpmathlib macro ;(routine)
movea.l dpmathbase(pc),a6
jsr \1(a6)
endm
movedp macro
ifc '\1','d0' ;<d0,register>
ifc '\2','d2'
move.l d0,d2
move.l d1,d3
mexit
endc
ifc '\2','d4'
move.l d0,d4
move.l d1,d5
mexit
endc
ifc '\2','d6'
move.l d0,d6
move.l d1,d7
mexit
endc
endc
ifc '\1','d2' ;<d2,register>
ifc '\2','d0'
move.l d2,d0
move.l d3,d1
mexit
endc
ifc '\2','d4'
move.l d2,d4
move.l d3,d5
mexit
endc
ifc '\2','d6'
move.l d2,d6
move.l d3,d7
mexit
endc
endc
ifc '\1','d4' ;<d4,register>
ifc '\2','d0
move.l d4,d0
move.l d5,d1
mexit
endc
ifc '\2','d2'
move.l d4,d2
move.l d5,d3
mexit
endc
ifc '\2','d6'
move.l d4,d6
move.l d5,d7
mexit
endc
endc
ifc '\1','d6' ;<d6,register>
ifc '\2','d0'
move.l d6,d0
move.l d7,d1
mexit
endc
ifc '\2','d2'
move.l d6,d2
move.l d7,d3
mexit
endc
ifc '\2','d4'
move.l d6,d4
move.l d7,d5
mexit
endc
endc
ifeq NARG-2
ifc '\2','d0' ;<label,register>
move.l \1(pc),d0
move.l \1+4(pc),d1
mexit
endc
ifc '\2','d2'
move.l \1(pc),d2
move.l \1+4(pc),d3
mexit
endc
ifc '\2','d4'
move.l \1(pc),d4
move.l \1+4(pc),d5
mexit
endc
ifc '\2','d6'
move.l \1(pc),d6
move.l \1+4(pc),d7
mexit
endc
move.l \1(pc),\2 ;<label1,label2>
move.l \1+4(pc),\2+4
mexit
endc
ifeq NARG-1 ;<label>
move.l d0,\1 ;d0 -> label1
move.l d1,\1+4 ;d1 -> label1a
endc
endm
move2 macro
move.l \1(pc),d0
move.l \1+4(pc),d1
move.l \2(pc),d2
move.l \2+4(pc),d3
endm
move1 macro ;<label>
move.l \1(pc),d2
move.l \1+4(pc),d3
endm
move0 macro
move.l \1(pc),d0
move.l \1+4(pc),d1
endm
adddp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dpmathlib dpadd
endm
subdp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dpmathlib dpsub
endm
muldp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dpmathlib dpmul
endm
divdp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dpmathlib dpdiv
endm
fltdp macro
ifeq NARG-1 ;<value>
move.l #\1,d0
endc
dpmathlib dpflt
endm
fixdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dpmathlib dpfix
endm
absdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dpmathlib dpabs
endm
negdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dpmathlib dpneg
endm
cmpdp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dpmathlib dpcmp
endm
tstdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dpmathlib dptst
endm
;MATHIEEEDOUBTRANS OFFSETS
dpatan equ -30
dpsin equ -36
dpcos equ -42
dptan equ -48
dpsincos equ -54
dpsinh equ -60
dpcosh equ -66
dptanh equ -72
dpexp equ -78
dplog equ -84
dppow equ -90
dpsqrt equ -96
dptieee equ -102
dpfieee equ -108
dpasin equ -114
dpacos equ -120
dplog10 equ -126
;macros
dptranslib macro
movea.l dptransbase(pc),a6 ;<routine>
jsr \1(a6)
endm
sindp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpsin
endm
cosdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpcos
endm
tandp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dptan
endm
sincosdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpsincos
endm
asindp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpasin
endm
acosdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpacos
endm
atandp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpatan
endm
sinhdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpsinh
endm
coshdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpcosh
endm
tanhdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dptanh
endm
sqrtdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpsqrt
endm
expdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dpexp
endm
powdp macro
ifeq NARG-2 ;<label1,label2>
move2 \1,\2
endc
ifeq NARG-1 ;<label>
move1 \1
endc
dptranslib dppow
endm
logdp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dplog
endm
log10dp macro
ifeq NARG-1 ;<label>
move0 \1
endc
dptranslib dplog10
endm
convertdp macro
movem.l d2-d7,-(sp)
moveq #0,d0
moveq #0,d1
moveq #0,d4
moveq #0,d5
suba.l a2,a2
cmpi.b #'-',(a0)
bne.s positive\@
bset #31,d4
addq.l #1,a0
positive\@
getdigit\@
move.b (a0)+,d5
cmpi.b #'.',d5
bne testdigit\@
move.w #1,a2
moveq #0,d7
bra getdigit\@
testdigit\@
cmpi.b #'9',d5
bhi.s zerocheck\@
cmpi.b #'0',d5
blt.s zerocheck\@
andi.l #$0f,d5
movedp d0,d2
asl.l #1,d1
roxl.l #1,d0
asl.l #1,d3
roxl.l #1,d2
asl.l #1,d3
roxl.l #1,d2
asl.l #1,d3
roxl.l #1,d2
moveq #0,d6
add.l d3,d1
addx.l d2,d0
add.l d5,d1
addx.l d6,d0
addq.w #1,d7
cmpi.w #16,d7
bne getdigit\@
dperror\@
; moveq #1,d6
; rts
zerocheck\@
movea.l a0,a5
tst.l d1
bne.s zerocheck1\@
tst.l d0
beq.s dpdone\@
zerocheck1\@
move.l #$43f,d6
zerocheck2\@
subq.l #1,d6
asl.l #1,d1
roxl.l #1,d0
bcc.s zerocheck2\@
moveq #11,d5
shiftdown\@
lsr.l #1,d0
roxr.l #1,d1
dbra d5,shiftdown\@
swap d6
asl.l #4,d6
or.l d6,d0
cmpa #0,a2
beq.s dosign\@
subq.l #1,d7
bmi.s dosign\@
fractionalize\@
move.l #$40240000,d2
moveq #0,d3
divdp
dbra.s d7,fractionalize\@
dosign\@
or.l d4,d0
dpdone\@
moveq #0,d6
movem.l (sp)+,d2-d7
endm